<template>
	<view class="content" :style="theme">
		<view class="head">
			<image class="jbicon" :src="imgHost+'/yundong_ic_jiangbei.png'"></image>
			<image class="phb" :src="imgHost+'/title_paihangbang.png'"></image>
			<view class="gxsj">更新时间：{{info.updateDate}}</view>
			<view class="card flex-ca">
				<image class="cj" :src="imgHost+'/ic_wodechengji.png'"></image>
				<image class="tx" :src="info.member.headImg?info.member.headImg:imgHost+'/user.png'"></image>
				<view class="dqname">{{info.member.name}}</view>
				<view class="mc"><text>{{info.member.ranking}}</text>{{info.member.ranking!='暂无排名'?'名':''}}</view>
				<view class="fz"><text>{{info.member.sportTime}}</text>分钟</view>
			</view>
		</view>
		<view class="ul">
			<view class="li flex-cb">
				<view>排名</view>
				<view>姓名</view>
				<view>运动时长(分)</view>
			</view>
			<view v-for="(item, index) in list" :key="index" class="li flex-cb">
				<view>
					<image v-if="item.ranking<=3" :src="imgHost + '/daka_ic_' + item.ranking +'.png'"></image>
					<text v-else>{{item.ranking }}</text>
				</view>
				<view>
					<image :src="item.headImg?item.headImg:imgHost+'/user.png'"></image><text>{{item.name}}</text>
				</view>
				<view class="li_num" :class="item.ranking<=3?'qs':''">{{item.sportTime}}</view>
			</view>
		</view>
		<u-loadmore v-if="end && list.length >= 10" :status="status" line />
		<view v-if="list.length === 0" class="no-order">
			<image :src="imgHost+'/default_nodata.png'"></image>
			<view>暂无活动～</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				end: false, //控制是否还能切换下一页
				page: 1, //页码
				list: [],
				info: {},
				status: 'nomore',
				firstQueryTime: ''
			}
		},
		onLoad() {
			this.firstQueryTime = this.$app.firstQueryTime()
			this.getList()
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			getList() {
				this.$app.ajax({
					data: {
						pagination: {
							firstQueryTime: this.firstQueryTime,
							page: this.page,
							rows: 15
						},
						param: {
							venueId: this.venueId,
							memberId: this.userInfo.id,
						}
					},
					api: this.$api.sportRanking()
				}).then((res) => {
					if (res.errorCode === '000000') {
						if (!res.record.memberList || res.record.memberList.length < 15) {
							this.end = true
						}
						if (res.record.memberList) {
							this.list = this.list.concat(res.record.memberList)
						}
						this.info = res.record
					}
				}).catch(() => {})
			},
			reachBottom() {
				if (!this.end) {
					this.page += 1;
					this.getList();
				}
			},
			// 触底加载更多数据
			onReachBottom(e) {
				this.reachBottom()
			}
		}

	}
</script>
<style scoped lang="scss">
	.content {
		background: $red;
		min-height: 100vh;
	}
	.head {
		padding: 60rpx 30rpx 116rpx;
		box-sizing: border-box;
		position: relative;
	}

	.head .phb {
		width: 176rpx;
		z-index: 10;
		height: 56rpx;
	}

	.jbicon {
		position: absolute;
		top: 0;
		right: 0;
		width: 376rpx;
		height: 320rpx;
		z-index: 1;
	}

	.gxsj {
		font-size: 24rpx;
		z-index: 10;
		font-weight: 400;
		line-height: 1;
		margin: 30rpx 0 60rpx;
		color: #FFFFFF;
	}

	.card {
		width: 690rpx;
		position: absolute;
		left: 30rpx;
		bottom: 0;
		z-index: 10;
		margin: 0 auto;
		background: #FFFFFF;
		box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(0, 0, 0, 0.08);
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 0 30rpx;
		height: 116rpx;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 1.5;
		color: #222222;
	}

	.cj {
		width: 52rpx;
		height: 56rpx;
		margin-right: 40rpx;
	}

	.tx {
		width: 56rpx;
		border-radius: 50%;
		height: 56rpx;
		margin-right: 20rpx;
	}

	.dqname {
		flex: 1;
	}

	.mc {
		flex: 1;
		font-size: 22rpx;
		text-align: center;
	}

	.mc text {
		font-size: 30rpx;
		font-weight: bold;
	}

	.fz {
		flex: 1;
		font-size: 22rpx;
		text-align: right;
		color: #FF8346;
	}

	.fz text {
		font-size: 30rpx;
		font-weight: bold;
	}

	.ul {
		margin-top: 90rpx;
		background-color: #fff;
		border-radius: 20rpx;
		width: 690rpx;
		padding: 20rpx 0;
		margin: 30rpx auto;
	}

	.ul .li view {
		text-align: center;
		flex: 1;
		height: 56rpx;
		line-height: 56rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ul .li {
		margin-bottom: 30rpx;
		font-size: 28rpx;
		color: #222222;
	}

	.ul .li:first-of-type view {
		color: #666666;
		font-size: 24rpx;
	}

	.ul .li view:first-of-type image {
		width: 44rpx;
		height: 44rpx;
	}

	.ul .li view:nth-of-type(2) image {
		width: 56rpx;
		height: 56rpx;
		margin-right: 16rpx;
		border-radius: 50%;
	}

	.li_num {
		font-weight: 600;
		color: #FF8346;
		font-size: 30rpx;
	}

	.li_num.qs {
		color: $color;
	}

	.ul .li view:nth-of-type(2) {
		flex: 2;
	}
</style>
